
+function(app) {

	// 注册
	$(function() {
		var space = $(".container");
		var form = space.find("form[name=register]");
		if (form.length == 0) { return; }
		var btn = space.find(".do-submit");

		var inputs = form.find("input[type=text],input[type=password]");

		var submit = function(e) {
			e.preventDefault();
			btn.zajax(form, {login:true, rememberMe:true}, function(json) {
				var account = form.find("input[name=account]").val();
				window.Cookies && Cookies.set("AUTH_ACCOUNT", account, { path:app.getCookiePath() });
				app.toMainPage.call(form, json);
			});
		};

		// 绑定事件-提交
		btn.click(submit);

		// 回车键移到下一输入框, 最后一个回车提交
		Utils.enterToNext(inputs, submit);

		// 绑定事件-发送短信验证码
		form.find(".do-send").click(app.doSendSmsCode);

		if (window.Cookies) {
			var account = Cookies.get("TEMP_ACCOUNT");
			account && form.find("input[name=account]").val(account);
		}
		
		var uploader = space.find("form.file-upload-box");
		uploader.find("input[type=file]").change(function() {
			uploader.zupload({
				step: function(e) {
					space.find("img.portrait-img").attr("src", e.url);
					form.find("input[name=photo]").val(e.url);
				}
			});
		});
	});

}(window.app);

